package com.slofzx.nuoda.evaluation.project.controller;

import com.slofzx.nuoda.common.dto.FileDTO;
import com.slofzx.nuoda.common.enums.ServiceResult;
import com.slofzx.nuoda.common.vo.AjaxResultVO;
import com.slofzx.nuoda.common.vo.PageResultVO;
import com.slofzx.nuoda.evaluation.core.enums.ResultEnum;
import com.slofzx.nuoda.evaluation.project.dto.ReportInfoVO;
import com.slofzx.nuoda.evaluation.project.service.ReportInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/report")
public class ReportInfoController {
    @Autowired
    private ReportInfoService reportInfoService;

    @GetMapping("/data")
    public PageResultVO<List<ReportInfoVO>> queryList(ReportInfoDTO dto) {
        List<ReportInfoVO> dataList = reportInfoService.queryList(dto);
        return PageResultVO.newSuccessResult(dataList, dto.getCount());
    }
    @PostMapping("/save")
    public AjaxResultVO save(FileDTO fileDTO) {
        ServiceResult serviceResult =  reportInfoService.save(fileDTO);
        return AjaxResultVO.getInstance(serviceResult);
    }
}
